using System;
using RomanJendrusz.Amazon.ETL.Domain;
using System.Linq;

namespace RomanJendrusz.Amazon.ETL.Repositories
{
    public class AuthorRepository: Repository<Author, int>, IAuthorRepository
    {
        public AuthorRepository(ISession session)
            : base(session, s => s.Authors, "AuthorId")
        {
        }

        public Author AttachIfAllreadyExists(Author item)
        {
            throw new NotImplementedException();
        }

        public Author FindByName(string name)
        {
            return session.Authors.SingleOrDefault(a => a.FullName == name);
        }
    }
}